package com.xlisteven.feign;

import com.xlisteven.entity.Product;
import com.xlisteven.fallback.ProductFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

@Component
@FeignClient(value = "cloud-product",fallbackFactory = ProductFallback.class)
public interface ProductClient {

    @GetMapping("/product/getProductList/{pId}")
    List<Product> getProductList(@PathVariable(name = "pId") long pId);

    @PostMapping("/product/insert")
    void insert(@RequestBody  List<Product> productList);
}
